Holds an image data and its description in memory. More...
Public Member Functions | |
| ImageData () | |
| ImageData (ImageData &&other) | |
| ~ImageData () | |
| nkMaths::Vector | getPixelAt (unsigned int xPix, unsigned int yPix) |
| void | setPixelAt (unsigned int xPix, unsigned int yPix, const nkMaths::Vector &color) |
| bool | exportToFileAsBmp (const char *path) |
| ImageData & | operator= (ImageData &&other) |
Public Attributes | |
| unsigned char * | _data = nullptr |
| The image data. | |
| unsigned int | _width = 0 |
| The width of the image, in pixels. | |
| unsigned int | _height = 0 |
| The height of the image, in pixels. | |
| unsigned int | _rowByteSize = 0 |
| The size, in byte, of one row of the image. It can be different from _width * sizeof(format), for memory alignment purpose. Always check this member for safe reading, if not using the methods. | |
| FORMAT | _imageFormat = R8G8B8A8_UNORM |
| The format of the image data. | |
Holds an image data and its description in memory.
Currently meant as a data holder returned by other classes for easo of access. It owns the memory attached to it.
| nkGraphics::ImageData::ImageData | ( | ) |
Default constructor.
| nkGraphics::ImageData::ImageData | ( | ImageData && | other | ) |
Move constructor.
| nkGraphics::ImageData::~ImageData | ( | ) |
Destructor.
| nkMaths::Vector nkGraphics::ImageData::getPixelAt | ( | unsigned int | xPix, |
| unsigned int | yPix | ||
| ) |
Returns the pixel value at given coordinates.
| xPix | The x coordinate of the pixel. |
| yPix | The y coordinate of the pixel. |
| void nkGraphics::ImageData::setPixelAt | ( | unsigned int | xPix, |
| unsigned int | yPix, | ||
| const nkMaths::Vector & | color | ||
| ) |
Forces a pixel value.
| xPix | The x coordinate of the pixel. |
| yPix | The y coordinate of the pixel. |
| color | The color to set. It has to be consistent with the format. |
| bool nkGraphics::ImageData::exportToFileAsBmp | ( | const char * | path | ) |
Exports the data in a bmp file.
| path | The path to export to, absolute or relative to the execution path. |
Equality operator.
| other | The other image data to copy. |